package com.ssy.lingxi.enhance.entity;


import com.ssy.lingxi.enhance.handler.convert.JpaJsonToPNOReceiveDeliverDetailProductBOConverter;
import com.ssy.lingxi.enhance.model.bo.PNOReceiveDeliverDetailProductBO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.*;
import java.io.Serializable;
import java.util.List;

/**
 * 生产通知单收发货明细 - DO
 * @author fhj
 * @date 2020/11/04
 * @version 2.0.0
 */
@Data
@Entity
@Table(schema = "public", name = "enhance_pno_receive_deliver_detail", indexes = {
        @Index(name = "enhance_pno_receive_deliver_detail_produce_notice_order_id_idx", columnList = "produceNoticeOrderId")
})
public class PNOReceiveDeliverDetailDO implements Serializable {
    private static final long serialVersionUID = -3448482031798283563L;

    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "pno_receive_deliver_detail_seq")
    @SequenceGenerator(sequenceName = "enhance_pno_receive_deliver_detail_seq", name = "pno_receive_deliver_detail_seq", allocationSize = 1)
    @ApiModelProperty(value = "ID")
    private Long id;

    @Column(columnDefinition = "int8")
    @ApiModelProperty(value = "生产通知单ID")
    private Long produceNoticeOrderId;

    @Column(columnDefinition = "varchar(20)")
    @ApiModelProperty(value = "通知单号（冗余给报表服务的结算功能字段）")
    private String noticeNo;

    @Column(columnDefinition = "varchar(60)")
    @ApiModelProperty(value = "通知单摘要（冗余给报表服务的结算功能字段）")
    private String summary;

    @Column(columnDefinition = "int8")
    @ApiModelProperty(value = "单据时间（冗余给报表服务的结算功能字段）")
    private Long produceNoticeOrderTime;

    @Column(columnDefinition = "int8")
    @ApiModelProperty(value = "发货单ID")
    private Long deliveryId;

    @Column(columnDefinition = "varchar(50)")
    @ApiModelProperty(value = "发货单号")
    private String deliveryNo;

    @Column(columnDefinition = "int8")
    @ApiModelProperty(value = "发货时间")
    private Long deliveryTime;

    @Column(columnDefinition = "int4")
    @ApiModelProperty(value = "发货批次")
    private Integer deliveryBatch;

    @Column(columnDefinition = "int8")
    @ApiModelProperty(value = "物流单ID")
    private Long logisticsOrderId;

    @Column(columnDefinition = "varchar(50)")
    @ApiModelProperty(value = "物流单号")
    private String logisticsOrderNo;

    @Column(columnDefinition = "varchar(50)")
    @ApiModelProperty(value = "物流公司")
    private String logisticsCompany;

    @Column(columnDefinition = "int8")
    @ApiModelProperty(value = "入库单ID")
    private Long storageId;

    @Column(columnDefinition = "varchar(50)")
    @ApiModelProperty(value = "入库单号")
    private String storageNo;

    @Column(columnDefinition = "int8")
    @ApiModelProperty(value = "入库时间")
    private Long storageTime;

    @Column(columnDefinition = "int8")
    @ApiModelProperty(value = "收货时间")
    private Long receiveTime;

    @Column(columnDefinition = "int2")
    @ApiModelProperty(value = "发货状态：1-待确认发货 2-已确认发货")
    private Integer deliverStatus = 1;

    @Column(columnDefinition = "int2")
    @ApiModelProperty(value = "收货状态：1-待确认收货 2-已确认收货")
    private Integer receiveStatus = 1;

    @Column(columnDefinition = "int2")
    @ApiModelProperty(value = "回单状态：1-待确认回单 2-已确认回单")
    private Integer receiptStatus = 1;

    @Column(columnDefinition = "numeric")
    @ApiModelProperty(value = "加工费（冗余给报表服务的结算功能字段）")
    private Double processTotalPrice;

    @Column(columnDefinition = "numeric")
    @ApiModelProperty("收货数量（冗余给报表服务的结算功能字段）")
    private Double receiveNum;

    @Column(columnDefinition = "numeric")
    @ApiModelProperty("结算金额（冗余给报表服务的结算功能字段）")
    private Double receivePrice;

    @Convert(converter = JpaJsonToPNOReceiveDeliverDetailProductBOConverter.class)
    @Column(columnDefinition = "jsonb")
    @ApiModelProperty(value = "生产通知单收发货明细商品")
    private List<PNOReceiveDeliverDetailProductBO> pnoReceiveDeliverDetailProductBOList;

    @Column(columnDefinition = "int8")
    @ApiModelProperty(value = "创建时间")
    private Long createTime = System.currentTimeMillis();
}
